import React, { useContext } from 'react'
import { MobXProviderContext } from 'mobx-react'

const useStore = (name) => {
  const context = useContext(MobXProviderContext).store[name]
  if (!context) {
    console.log(`Can not find the ${name} store`)
  }
  return context ?? null
}

export default useStore
